// 云函数入口文件
const cloud = require('wx-server-sdk')
const rp = require('request-promise')
cloud.init()
const URL = 'http://musicapi.xiecheng.live'

// 云函数入口函数
exports.main = async (event, context) => { 
  let keyword =  encodeURI(event.keyword)
  let page = encodeURI(event.page)
  let keywordList = await rp(URL+`/search?limit=15&offset=${page}&keywords=${keyword}`)
  return JSON.parse(keywordList)
}